package cn.peifu.hrm.feign;

import cn.peifu.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class SystemFeignFallbackFactory implements FallbackFactory<SystemFeignClient> {
    @Override
    public SystemFeignClient create(Throwable throwable) {
        return new SystemFeignClient() {

            @Override
            public AjaxResult selectByLoginId(Long loginId) {
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setMessage("服务降级！System服务不可用！");
            }
        };
    }
}
